﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;

namespace WroxGallery.Tests.Actions
{
    public static class ActionFiltersTestingHelper
    {
        public static ActionExecutedContext GetActionExecutedContext(ViewDataDictionary viewdata)
        {
            RouteData routeData = new RouteData();
            ControllerContext controllerContext = new ControllerContext(
                new FakeHttpContextBase(), routeData, new FakeController());
            ActionExecutedContext context = new ActionExecutedContext(controllerContext, new FakeActionDescriptor(),
                                                                      false, null);
            ViewResult result = new ViewResult();
            result.ViewData = viewdata;
            context.Result = result;
            return context;
        }

        internal class FakeController : Controller
        {

        }

        internal class FakeHttpContextBase : HttpContextBase
        {

        }

        internal class FakeActionDescriptor : ActionDescriptor
        {
            public override object Execute(ControllerContext controllerContext, IDictionary<string, object> parameters)
            {
                throw new System.NotImplementedException();
            }

            public override ParameterDescriptor[] GetParameters()
            {
                throw new System.NotImplementedException();
            }

            public override string ActionName
            {
                get { throw new System.NotImplementedException(); }
            }

            public override ControllerDescriptor ControllerDescriptor
            {
                get { throw new System.NotImplementedException(); }
            }
        }
    }


}
